package com.xwn.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xwn.pipeline.NetEaseMusicPipeline;
import com.xwn.processor.NetEaseMusicPageProcessor;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;


@Slf4j
@RestController
@Api(value="爬虫开启", tags="爬虫开启")
public class StartApi {
	@Autowired
	NetEaseMusicPageProcessor mProcessor;
	@Autowired
	NetEaseMusicPipeline mPipeline;

	@GetMapping("/")
	public String index() {
		new Thread(() -> mProcessor.start(mProcessor, mPipeline)).start();
		log.info("--------------------开始爬虫----------------------");
		return "爬虫开启";
	}
}
